Repository navigation
typescript: a call to a function-literal const no longer also names its annotation's signature (#2005) - #2027
Merged
Conversation
… keeps its own version) 0.2.3 is released, so what merges into this branch ships in 0.2.4. package.json (version and the five @axiomcode/engine-* pins) and the four editor plugin and extension manifests move from 0.2.3 to 0.2.4. The parser keeps its own version.
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
November 18, 2026 23:33
…ts annotation's signature (#2005) A call to a const annotated with a callable type and holding a function literal resolved two ways: the literal's body and the annotation's bodiless call signature. Rule (3) in callee-resolution.dl added the signature of the callee's expr_type or expr_shape with no check that the callee already holds a literal, which the method lookup answers with its body. The namespace var_shape clause in expr-type.dl carried that guard; rule (3) did not. Rule (3) now skips a callee that holds a function literal (callee_holds_function): a local, a named import, or a namespace member read. The relation is built from relations below the expression fixpoint, so the negation stays stratifiable. A const holding a factory's result, and a parameter, keep the signature as the target. Case 101 pins the interface and function-type-alias forms through a local, a named import and a namespace read, with factory and parameter controls. On the base each literal site is multi_inferred to body and signature; here each is one known_edge to the body. Goldens: the same two-way hedge collapses to the body in 08 (lib), 63, 65, 74 and 77. The compiler names the annotation's signature, so 08, 63 and 65 record it in known-missing, the shape 92 and 98 already accept; 77 loses an extra. The comment in case 65 describes what a revert now looks like.
…-annotated-function-const
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2005
Summary
A call to a const annotated with a callable type and holding a function literal resolved to two targets, the literal's body and the annotation's bodiless call signature:
Rule (3) in
callee-resolution.dladds the call signature of the callee'sexpr_type/expr_shapewith no check that the callee already holds a literal. The namespacevar_shapeclause inexpr-type.dlcarried that guard; rule (3) did not. Rule (3) now skips a callee that holds a function literal (a local, a named import, or a namespace member read). A const holding a factory's result, and a parameter, keep the signature.Review these first
graph/typescript/engine/expression-resolution/callee-resolution.dl: the!callee_holds_function(ne)guard on both rule (3) clauses, andcallee_holds_function. It reads onlyexpr_referenced,import_binds,property_access_recv,expr_namespace,module_exportandvar_is_function, which are below the expression fixpoint (expr_callablealready uses them under a negation), so the negation stays stratifiable.Tests
101-annotated-function-const: the interface and function-type-alias forms, each through a local, a named import and a namespace read, with a factory-result and a parameter control.0.2.4): each of the literal sites ismulti_inferredto the body and the signature.known_edgeto the body; the controls are unchanged.08(lib),63,65: the compiler names the annotation's signature, so the site is recorded inknown-missing, the shape92and98already accept.74: a JSX component const typed by a generic callable.77: an extra edge goes.65now says what a revert of its arity relaxation looks like, since the body is each cell's one edge.